package com.example.file_demo.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 读取项目相关配置
 *
 * @author ruoyi
 */
@Setter
@Component
@ConfigurationProperties(prefix = "hcc-common")
public class HccCommonConfig {
    /** 上传路径 */
    @Getter
    private static String profile = "D:/ruoyi/uploadPath";
    /** 获取地址开关 */
    private static boolean addressEnabled;

//    public void setProfile(String profile)
//    {
//        HccCommonConfig.profile = profile;
//    }

    public static boolean isAddressEnabled() {
        return addressEnabled;
    }

    public void setAddressEnabled(boolean addressEnabled)
    {
        HccCommonConfig.addressEnabled = addressEnabled;
    }

    /**
     * 获取导入上传路径
     */
    public static String getImportPath()
    {
        return getProfile() + "/import";
    }

    /**
     * 获取头像上传路径
     */
    public static String getAvatarPath()
    {
        return getProfile() + "/avatar";
    }

    /**
     * 获取下载路径
     */
    public static String getDownloadPath()
    {
        return getProfile() + "/download/";
    }

    /**
     * 获取上传路径
     */
    public static String getUploadPath()
    {
        return getProfile() + "/upload";
    }
}
